css: Pass relevant properties to css lookup code
authorBenjamin Otte <otte@redhat.com>
Fri, 24 Aug 2012 15:31:57 +0000 (17:31 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 28 Aug 2012 13:42:24 +0000 (15:42 +0200)
This is not used yet in this patch.

gtk/gtkcsslookup.c
gtk/gtkcsslookupprivate.h
gtk/gtkstylecontext.c

index e0f0af78f60f8fabc4dda6c35e98a98c6cb55bde..67d7b1c21b96274f1e7577d0b864ff4d33532be8 100644 (file)
@@ -36,14 +36,22 @@ struct _GtkCssLookup {
 };
 
 GtkCssLookup *
-_gtk_css_lookup_new (void)
+_gtk_css_lookup_new (const GtkBitmask *relevant)
 {
   GtkCssLookup *lookup;
   guint n = _gtk_css_style_property_get_n_properties ();
 
   lookup = g_malloc0 (sizeof (GtkCssLookup) + sizeof (GtkCssLookupValue) * n);
-  lookup->missing = _gtk_bitmask_new ();
-  lookup->missing = _gtk_bitmask_invert_range (lookup->missing, 0, n);
+
+  if (relevant)
+    {
+      lookup->missing = _gtk_bitmask_copy (relevant);
+    }
+  else
+    {
+      lookup->missing = _gtk_bitmask_new ();
+      lookup->missing = _gtk_bitmask_invert_range (lookup->missing, 0, n);
+    }
 
   return lookup;
 }
@@ -169,11 +177,13 @@ _gtk_css_lookup_resolve (GtkCssLookup         *lookup,
                                             lookup->values[i].computed,
                                             0,
                                             lookup->values[i].section);
-      else
+      else if (lookup->values[i].value ||
+               _gtk_bitmask_get (lookup->missing, i))
         _gtk_css_computed_values_compute_value (values,
                                                 context,
                                                 i,
                                                 lookup->values[i].value,
                                                 lookup->values[i].section);
+      /* else not a relevant property */
     }
 }
index 3e8824cdc7d36cc35090abf72402b4ace2fc0208..72b0b18fc2f9d9d354e19e71403539d66ff7f290 100644 (file)
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
 
 typedef struct _GtkCssLookup GtkCssLookup;
 
-GtkCssLookup *          _gtk_css_lookup_new                     (void);
+GtkCssLookup *          _gtk_css_lookup_new                     (const GtkBitmask   *relevant);
 void                    _gtk_css_lookup_free                    (GtkCssLookup       *lookup);
 
 const GtkBitmask *      _gtk_css_lookup_get_missing             (const GtkCssLookup *lookup);
index a98f194cb9ce65e77e12709887c7456f027ff1a2..d1042b9861451dff81e368a1f89ac943450b7f17 100644 (file)
@@ -902,7 +902,7 @@ build_properties (GtkStyleContext *context,
 
   priv = context->priv;
 
-  lookup = _gtk_css_lookup_new ();
+  lookup = _gtk_css_lookup_new (NULL);
 
   if (_gtk_css_matcher_init (&matcher, path, state))
     _gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),